package com.example.customview;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.data.DataInfoItem;
import com.example.viewpagerandgridview.R;

public class DataItemView extends RelativeLayout{
	private TextView textView_name;
	private ImageView imageView_icon;
	private DataInfoItem dataInfoItem ;
	public DataItemView(Context context,DataInfoItem dataInfoItem) {
		super(context);
		// TODO Auto-generated constructor stub
		LayoutInflater inflater = (LayoutInflater)context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
		inflater.inflate( R.layout.dataitemview , this );
		textView_name = (TextView)findViewById(R.id.item_name);
		imageView_icon = (ImageView)findViewById(R.id.item_image);
		this.dataInfoItem = dataInfoItem;
		textView_name.setText(dataInfoItem.getName());
		imageView_icon.setImageBitmap(dataInfoItem.getIcon());
	}
	public void updateaItemView(DataInfoItem dataInfoItem){
		this.dataInfoItem = dataInfoItem;
		textView_name.setText(dataInfoItem.getName());
		imageView_icon.setImageBitmap(dataInfoItem.getIcon());
	}
}
